package org.example.invest.raw;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.fisco.bcos.sdk.abi.FunctionReturnDecoder;
import org.fisco.bcos.sdk.abi.TypeReference;
import org.fisco.bcos.sdk.abi.datatypes.Address;
import org.fisco.bcos.sdk.abi.datatypes.Bool;
import org.fisco.bcos.sdk.abi.datatypes.Event;
import org.fisco.bcos.sdk.abi.datatypes.Function;
import org.fisco.bcos.sdk.abi.datatypes.Type;
import org.fisco.bcos.sdk.abi.datatypes.Utf8String;
import org.fisco.bcos.sdk.abi.datatypes.generated.Bytes32;
import org.fisco.bcos.sdk.abi.datatypes.generated.Uint256;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple1;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple3;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple4;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple6;
import org.fisco.bcos.sdk.abi.datatypes.generated.tuples.generated.Tuple7;
import org.fisco.bcos.sdk.client.Client;
import org.fisco.bcos.sdk.contract.Contract;
import org.fisco.bcos.sdk.crypto.CryptoSuite;
import org.fisco.bcos.sdk.crypto.keypair.CryptoKeyPair;
import org.fisco.bcos.sdk.eventsub.EventCallback;
import org.fisco.bcos.sdk.model.CryptoType;
import org.fisco.bcos.sdk.model.TransactionReceipt;
import org.fisco.bcos.sdk.model.callback.TransactionCallback;
import org.fisco.bcos.sdk.transaction.model.exception.ContractException;

@SuppressWarnings("unchecked")
public class InvestmentManagement extends Contract {
    public static final String[] BINARY_ARRAY = {"608060405234801561001057600080fd5b50611bc9806100206000396000f30060806040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806322ae634f14610093578063360276f61461020857806349ccb3ab1461024d5780638f3b2b9f14610292578063acf024a214610402578063b453a6ff1461042f578063c5167dbc146104f2578063d6e42647146105bf575b600080fd5b34801561009f57600080fd5b506100be60048036038101908080359060200190929190505050610612565b604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200187815260200180602001806020018660001916600019168152602001856000191660001916815260200184151515158152602001838103835288818151815260200191508051906020019080838360005b83811015610160578082015181840152602081019050610145565b50505050905090810190601f16801561018d5780820380516001836020036101000a031916815260200191505b50838103825287818151815260200191508051906020019080838360005b838110156101c65780820151818401526020810190506101ab565b50505050905090810190601f1680156101f35780820380516001836020036101000a031916815260200191505b509950505050505050505060405180910390f35b34801561021457600080fd5b5061023760048036038101908080356000191690602001909291905050506108b0565b6040518082815260200191505060405180910390f35b34801561025957600080fd5b5061027c60048036038101908080356000191690602001909291905050506108d5565b6040518082815260200191505060405180910390f35b34801561029e57600080fd5b506102cb6004803603810190808035600019169060200190929190803590602001909291905050506108fd565b604051808781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185815260200180602001806020018460001916600019168152602001838103835286818151815260200191508051906020019080838360005b8381101561035b578082015181840152602081019050610340565b50505050905090810190601f1680156103885780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019080838360005b838110156103c15780820151818401526020810190506103a6565b50505050905090810190601f1680156103ee5780820380516001836020036101000a031916815260200191505b509850505050505050505060405180910390f35b34801561040e57600080fd5b5061042d60048036038101908080359060200190929190505050610b60565b005b34801561043b57600080fd5b506104f06004803603810190808035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610d77565b005b3480156104fe57600080fd5b506105a960048036038101908080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611413565b6040518082815260200191505060405180910390f35b3480156105cb57600080fd5b506105f8600480360381019080803590602001909291908035600019169060200190929190505050611969565b604051808215151515815260200191505060405180910390f35b60008060608060008060008088600073ffffffffffffffffffffffffffffffffffffffff166001600083815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156106fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e766573746d656e7420646f6573206e6f742065786973740000000000000081525060200191505060405180910390fd5b600160008b815260200190815260200160002091508160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682600201548360030184600401856005015486600601548760070160009054906101000a900460ff16848054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107f25780601f106107c7576101008083540402835291602001916107f2565b820191906000526020600020905b8154815290600101906020018083116107d557829003601f168201915b50505050509450838054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561088e5780601f106108635761010080835404028352916020019161088e565b820191906000526020600020905b81548152906001019060200180831161087157829003601f168201915b505050505093509850985098509850985098505050919395979092949650565b6000600260008360001916600019168152602001908152602001600020549050919050565b6000600360008360001916600019168152602001908152602001600020805490509050919050565b6000806000606080600080600360008a60001916600019168152602001908152602001600020805490508810151561099d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f496e646578206f7574206f6620626f756e64730000000000000000000000000081525060200191505060405180910390fd5b600360008a60001916600019168152602001908152602001600020888154811015156109c557fe5b9060005260206000209060080201905080600001548160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826002015483600301846004018560060154828054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aa65780601f10610a7b57610100808354040283529160200191610aa6565b820191906000526020600020905b815481529060010190602001808311610a8957829003601f168201915b50505050509250818054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b425780601f10610b1757610100808354040283529160200191610b42565b820191906000526020600020905b815481529060010190602001808311610b2557829003601f168201915b5050505050915096509650965096509650509295509295509295565b80600073ffffffffffffffffffffffffffffffffffffffff166001600083815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515610c3c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e766573746d656e7420646f6573206e6f742065786973740000000000000081525060200191505060405180910390fd5b813373ffffffffffffffffffffffffffffffffffffffff166001600083815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610d16576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4e6f7420617574686f72697a656400000000000000000000000000000000000081525060200191505060405180910390fd5b60006001600085815260200190815260200160002060070160006101000a81548160ff021916908315150217905550827f7b542ffdab00dd1ffd7caabcfa665f56b4e8283c477013177492aa67fe3521ec60405160405180910390a2505050565b600080600086600073ffffffffffffffffffffffffffffffffffffffff166001600083815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515610e58576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e766573746d656e7420646f6573206e6f742065786973740000000000000081525060200191505060405180910390fd5b873373ffffffffffffffffffffffffffffffffffffffff166001600083815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610f32576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f4e6f7420617574686f72697a656400000000000000000000000000000000000081525060200191505060405180910390fd5b8787876040516020018084815260200183805190602001908083835b602083101515610f735780518252602082019150602081019050602083039250610f4e565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b602083101515610fc65780518252602082019150602081019050602083039250610fa1565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020945033428a604051602001808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140183815260200182815260200193505050506040516020818303038152906040526040518082805190602001908083835b60208310151561110057805182526020820191506020810190506020830392506110db565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020935060036000600160008c81526020019081526020016000206005015460001916600019168152602001908152602001600020600160008b815260200190815260200160002090806001815401808255809150509060018203906000526020600020906008020160009091929091909150600082015481600001556001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506002820154816002015560038201816003019080546001816001161561010002031660029004611240929190611a71565b5060048201816004019080546001816001161561010002031660029004611268929190611a71565b5060058201548160050190600019169055600682015481600601906000191690556007820160009054906101000a900460ff168160070160006101000a81548160ff021916908315150217905550505050600160008a81526020019081526020016000209250878360020181905550868360030190805190602001906112ef929190611af8565b5085836004019080519060200190611308929190611af8565b5084836005018160001916905550838360060181600019169055508860026000866000191660001916815260200190815260200160002081905550887f6ea2ce18c27b82ef1c465e05e4e743d2284e8835c27805f5a2347602d912a799989898888604051808581526020018060200184600019166000191681526020018360001916600019168152602001828103825285818151815260200191508051906020019080838360005b838110156113cb5780820151818401526020810190506113b0565b50505050905090810190601f1680156113f85780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a2505050505050505050565b60008060008060008060008154809291906001019190505593508787876040516020018084815260200183805190602001908083835b60208310151561146e5780518252602082019150602081019050602083039250611449565b6001836020036101000a03801982511681845116808217855250505050505090500182805190602001908083835b6020831015156114c1578051825260208201915060208101905060208303925061149c565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040516020818303038152906040526040518082805190602001908083835b60208310151561152c5780518252602082019150602081019050602083039250611507565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209250334285604051602001808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140183815260200182815260200193505050506040516020818303038152906040526040518082805190602001908083835b6020831015156115fb57805182526020820191506020810190506020830392506115d6565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209150600160008581526020019081526020016000209050838160000181905550338160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550878160020181905550868160030190805190602001906116ac929190611af8565b50858160040190805190602001906116c5929190611af8565b50828160050181600019169055508181600601816000191690555060018160070160006101000a81548160ff02191690831515021790555083600260008460001916600019168152602001908152602001600020819055506003600084600019166000191681526020019081526020016000208190806001815401808255809150509060018203906000526020600020906008020160009091929091909150600082015481600001556001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506002820154816002015560038201816003019080546001816001161561010002031660029004611806929190611a71565b506004820181600401908054600181600116156101000203166002900461182e929190611a71565b5060058201548160050190600019169055600682015481600601906000191690556007820160009054906101000a900460ff168160070160006101000a81548160ff0219169083151502179055505050503373ffffffffffffffffffffffffffffffffffffffff16847f8b6bab32336c9a2ee36e5f21da913f44d1287f29413e98fb1e48e566b9e189d58a8a8787604051808581526020018060200184600019166000191681526020018360001916600019168152602001828103825285818151815260200191508051906020019080838360005b8381101561191e578082015181840152602081019050611903565b50505050905090810190601f16801561194b5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390a3839450505050509392505050565b600082600073ffffffffffffffffffffffffffffffffffffffff166001600083815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611a47576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e766573746d656e7420646f6573206e6f742065786973740000000000000081525060200191505060405180910390fd5b82600019166001600086815260200190815260200160002060050154600019161491505092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611aaa57805160ff1916838001178555611ae7565b82800160010185558215611ae7579182015b82811115611ae657825182559160200191611b4b565b5b509050611b749190611b78565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611b3957805160ff1916838001178555611b67565b82800160010185558215611b67579182015b82811115611b6657825182559160200191611b4b565b5b509050611b749190611b78565b5090565b611b9a91905b80821115611b96576000816000905550600101611b7e565b5090565b905600a165627a7a72305820e86db07fafa1d141b29db9ce8dbbc08c94aa282c275eb919cab857e040d5c5500029"};

    public static final String BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", BINARY_ARRAY);

    public static final String[] SM_BINARY_ARRAY = {};

    public static final String SM_BINARY = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", SM_BINARY_ARRAY);

    public static final String[] ABI_ARRAY = {"[{\"constant\":true,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"}],\"name\":\"getInvestment\",\"outputs\":[{\"name\":\"investor\",\"type\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\"},{\"name\":\"projectName\",\"type\":\"string\"},{\"name\":\"profession\",\"type\":\"string\"},{\"name\":\"dataHash\",\"type\":\"bytes32\"},{\"name\":\"txHash\",\"type\":\"bytes32\"},{\"name\":\"isActive\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_txHash\",\"type\":\"bytes32\"}],\"name\":\"getInvestmentByTxHash\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_dataHash\",\"type\":\"bytes32\"}],\"name\":\"getHistoryCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_dataHash\",\"type\":\"bytes32\"},{\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getHistoryAt\",\"outputs\":[{\"name\":\"id\",\"type\":\"uint256\"},{\"name\":\"investor\",\"type\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\"},{\"name\":\"projectName\",\"type\":\"string\"},{\"name\":\"profession\",\"type\":\"string\"},{\"name\":\"txHash\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"}],\"name\":\"deleteInvestment\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_projectName\",\"type\":\"string\"},{\"name\":\"_profession\",\"type\":\"string\"}],\"name\":\"updateInvestment\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_projectName\",\"type\":\"string\"},{\"name\":\"_profession\",\"type\":\"string\"}],\"name\":\"createInvestment\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_id\",\"type\":\"uint256\"},{\"name\":\"_dataHash\",\"type\":\"bytes32\"}],\"name\":\"verifyDataHash\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":true,\"name\":\"investor\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"projectName\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"dataHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"txHash\",\"type\":\"bytes32\"}],\"name\":\"InvestmentCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"projectName\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"dataHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"txHash\",\"type\":\"bytes32\"}],\"name\":\"InvestmentUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"id\",\"type\":\"uint256\"}],\"name\":\"InvestmentDeleted\",\"type\":\"event\"}]"};

    public static final String ABI = org.fisco.bcos.sdk.utils.StringUtils.joinAll("", ABI_ARRAY);

    public static final String FUNC_GETINVESTMENT = "getInvestment";

    public static final String FUNC_GETINVESTMENTBYTXHASH = "getInvestmentByTxHash";

    public static final String FUNC_GETHISTORYCOUNT = "getHistoryCount";

    public static final String FUNC_GETHISTORYAT = "getHistoryAt";

    public static final String FUNC_DELETEINVESTMENT = "deleteInvestment";

    public static final String FUNC_UPDATEINVESTMENT = "updateInvestment";

    public static final String FUNC_CREATEINVESTMENT = "createInvestment";

    public static final String FUNC_VERIFYDATAHASH = "verifyDataHash";

    public static final Event INVESTMENTCREATED_EVENT = new Event("InvestmentCreated", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>(true) {}, new TypeReference<Address>(true) {}, new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Bytes32>() {}, new TypeReference<Bytes32>() {}));
    ;

    public static final Event INVESTMENTUPDATED_EVENT = new Event("InvestmentUpdated", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>(true) {}, new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Bytes32>() {}, new TypeReference<Bytes32>() {}));
    ;

    public static final Event INVESTMENTDELETED_EVENT = new Event("InvestmentDeleted", 
            Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>(true) {}));
    ;

    protected InvestmentManagement(String contractAddress, Client client, CryptoKeyPair credential) {
        super(getBinary(client.getCryptoSuite()), contractAddress, client, credential);
    }

    public static String getBinary(CryptoSuite cryptoSuite) {
        return (cryptoSuite.getCryptoTypeConfig() == CryptoType.ECDSA_TYPE ? BINARY : SM_BINARY);
    }

    public Tuple7<String, BigInteger, String, String, byte[], byte[], Boolean> getInvestment(BigInteger _id) throws ContractException {
        final Function function = new Function(FUNC_GETINVESTMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {}, new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Bytes32>() {}, new TypeReference<Bytes32>() {}, new TypeReference<Bool>() {}));
        List<Type> results = executeCallWithMultipleValueReturn(function);
        return new Tuple7<String, BigInteger, String, String, byte[], byte[], Boolean>(
                (String) results.get(0).getValue(), 
                (BigInteger) results.get(1).getValue(), 
                (String) results.get(2).getValue(), 
                (String) results.get(3).getValue(), 
                (byte[]) results.get(4).getValue(), 
                (byte[]) results.get(5).getValue(), 
                (Boolean) results.get(6).getValue());
    }

    public BigInteger getInvestmentByTxHash(byte[] _txHash) throws ContractException {
        final Function function = new Function(FUNC_GETINVESTMENTBYTXHASH, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Bytes32(_txHash)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        return executeCallWithSingleValueReturn(function, BigInteger.class);
    }

    public BigInteger getHistoryCount(byte[] _dataHash) throws ContractException {
        final Function function = new Function(FUNC_GETHISTORYCOUNT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Bytes32(_dataHash)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        return executeCallWithSingleValueReturn(function, BigInteger.class);
    }

    public Tuple6<BigInteger, String, BigInteger, String, String, byte[]> getHistoryAt(byte[] _dataHash, BigInteger _index) throws ContractException {
        final Function function = new Function(FUNC_GETHISTORYAT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Bytes32(_dataHash), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_index)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Address>() {}, new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Bytes32>() {}));
        List<Type> results = executeCallWithMultipleValueReturn(function);
        return new Tuple6<BigInteger, String, BigInteger, String, String, byte[]>(
                (BigInteger) results.get(0).getValue(), 
                (String) results.get(1).getValue(), 
                (BigInteger) results.get(2).getValue(), 
                (String) results.get(3).getValue(), 
                (String) results.get(4).getValue(), 
                (byte[]) results.get(5).getValue());
    }

    public TransactionReceipt deleteInvestment(BigInteger _id) {
        final Function function = new Function(
                FUNC_DELETEINVESTMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void deleteInvestment(BigInteger _id, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_DELETEINVESTMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForDeleteInvestment(BigInteger _id) {
        final Function function = new Function(
                FUNC_DELETEINVESTMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id)), 
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple1<BigInteger> getDeleteInvestmentInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_DELETEINVESTMENT, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<BigInteger>(

                (BigInteger) results.get(0).getValue()
                );
    }

    public TransactionReceipt updateInvestment(BigInteger _id, BigInteger _amount, String _projectName, String _profession) {
        final Function function = new Function(
                FUNC_UPDATEINVESTMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_amount), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_projectName), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_profession)), 
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void updateInvestment(BigInteger _id, BigInteger _amount, String _projectName, String _profession, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_UPDATEINVESTMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_amount), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_projectName), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_profession)), 
                Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForUpdateInvestment(BigInteger _id, BigInteger _amount, String _projectName, String _profession) {
        final Function function = new Function(
                FUNC_UPDATEINVESTMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_amount), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_projectName), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_profession)), 
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple4<BigInteger, BigInteger, String, String> getUpdateInvestmentInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_UPDATEINVESTMENT, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple4<BigInteger, BigInteger, String, String>(

                (BigInteger) results.get(0).getValue(), 
                (BigInteger) results.get(1).getValue(), 
                (String) results.get(2).getValue(), 
                (String) results.get(3).getValue()
                );
    }

    public TransactionReceipt createInvestment(BigInteger _amount, String _projectName, String _profession) {
        final Function function = new Function(
                FUNC_CREATEINVESTMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_amount), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_projectName), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_profession)), 
                Collections.<TypeReference<?>>emptyList());
        return executeTransaction(function);
    }

    public void createInvestment(BigInteger _amount, String _projectName, String _profession, TransactionCallback callback) {
        final Function function = new Function(
                FUNC_CREATEINVESTMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_amount), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_projectName), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_profession)), 
                Collections.<TypeReference<?>>emptyList());
        asyncExecuteTransaction(function, callback);
    }

    public String getSignedTransactionForCreateInvestment(BigInteger _amount, String _projectName, String _profession) {
        final Function function = new Function(
                FUNC_CREATEINVESTMENT, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_amount), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_projectName), 
                new org.fisco.bcos.sdk.abi.datatypes.Utf8String(_profession)), 
                Collections.<TypeReference<?>>emptyList());
        return createSignedTransaction(function);
    }

    public Tuple3<BigInteger, String, String> getCreateInvestmentInput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getInput().substring(10);
        final Function function = new Function(FUNC_CREATEINVESTMENT, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}, new TypeReference<Utf8String>() {}, new TypeReference<Utf8String>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple3<BigInteger, String, String>(

                (BigInteger) results.get(0).getValue(), 
                (String) results.get(1).getValue(), 
                (String) results.get(2).getValue()
                );
    }

    public Tuple1<BigInteger> getCreateInvestmentOutput(TransactionReceipt transactionReceipt) {
        String data = transactionReceipt.getOutput();
        final Function function = new Function(FUNC_CREATEINVESTMENT, 
                Arrays.<Type>asList(), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
        List<Type> results = FunctionReturnDecoder.decode(data, function.getOutputParameters());
        return new Tuple1<BigInteger>(

                (BigInteger) results.get(0).getValue()
                );
    }

    public Boolean verifyDataHash(BigInteger _id, byte[] _dataHash) throws ContractException {
        final Function function = new Function(FUNC_VERIFYDATAHASH, 
                Arrays.<Type>asList(new org.fisco.bcos.sdk.abi.datatypes.generated.Uint256(_id), 
                new org.fisco.bcos.sdk.abi.datatypes.generated.Bytes32(_dataHash)), 
                Arrays.<TypeReference<?>>asList(new TypeReference<Bool>() {}));
        return executeCallWithSingleValueReturn(function, Boolean.class);
    }

    public List<InvestmentCreatedEventResponse> getInvestmentCreatedEvents(TransactionReceipt transactionReceipt) {
        List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(INVESTMENTCREATED_EVENT, transactionReceipt);
        ArrayList<InvestmentCreatedEventResponse> responses = new ArrayList<InvestmentCreatedEventResponse>(valueList.size());
        for (Contract.EventValuesWithLog eventValues : valueList) {
            InvestmentCreatedEventResponse typedResponse = new InvestmentCreatedEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.id = (BigInteger) eventValues.getIndexedValues().get(0).getValue();
            typedResponse.investor = (String) eventValues.getIndexedValues().get(1).getValue();
            typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            typedResponse.projectName = (String) eventValues.getNonIndexedValues().get(1).getValue();
            typedResponse.dataHash = (byte[]) eventValues.getNonIndexedValues().get(2).getValue();
            typedResponse.txHash = (byte[]) eventValues.getNonIndexedValues().get(3).getValue();
            responses.add(typedResponse);
        }
        return responses;
    }

    public void subscribeInvestmentCreatedEvent(String fromBlock, String toBlock, List<String> otherTopics, EventCallback callback) {
        String topic0 = eventEncoder.encode(INVESTMENTCREATED_EVENT);
        subscribeEvent(ABI,BINARY,topic0,fromBlock,toBlock,otherTopics,callback);
    }

    public void subscribeInvestmentCreatedEvent(EventCallback callback) {
        String topic0 = eventEncoder.encode(INVESTMENTCREATED_EVENT);
        subscribeEvent(ABI,BINARY,topic0,callback);
    }

    public List<InvestmentUpdatedEventResponse> getInvestmentUpdatedEvents(TransactionReceipt transactionReceipt) {
        List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(INVESTMENTUPDATED_EVENT, transactionReceipt);
        ArrayList<InvestmentUpdatedEventResponse> responses = new ArrayList<InvestmentUpdatedEventResponse>(valueList.size());
        for (Contract.EventValuesWithLog eventValues : valueList) {
            InvestmentUpdatedEventResponse typedResponse = new InvestmentUpdatedEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.id = (BigInteger) eventValues.getIndexedValues().get(0).getValue();
            typedResponse.amount = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue();
            typedResponse.projectName = (String) eventValues.getNonIndexedValues().get(1).getValue();
            typedResponse.dataHash = (byte[]) eventValues.getNonIndexedValues().get(2).getValue();
            typedResponse.txHash = (byte[]) eventValues.getNonIndexedValues().get(3).getValue();
            responses.add(typedResponse);
        }
        return responses;
    }

    public void subscribeInvestmentUpdatedEvent(String fromBlock, String toBlock, List<String> otherTopics, EventCallback callback) {
        String topic0 = eventEncoder.encode(INVESTMENTUPDATED_EVENT);
        subscribeEvent(ABI,BINARY,topic0,fromBlock,toBlock,otherTopics,callback);
    }

    public void subscribeInvestmentUpdatedEvent(EventCallback callback) {
        String topic0 = eventEncoder.encode(INVESTMENTUPDATED_EVENT);
        subscribeEvent(ABI,BINARY,topic0,callback);
    }

    public List<InvestmentDeletedEventResponse> getInvestmentDeletedEvents(TransactionReceipt transactionReceipt) {
        List<Contract.EventValuesWithLog> valueList = extractEventParametersWithLog(INVESTMENTDELETED_EVENT, transactionReceipt);
        ArrayList<InvestmentDeletedEventResponse> responses = new ArrayList<InvestmentDeletedEventResponse>(valueList.size());
        for (Contract.EventValuesWithLog eventValues : valueList) {
            InvestmentDeletedEventResponse typedResponse = new InvestmentDeletedEventResponse();
            typedResponse.log = eventValues.getLog();
            typedResponse.id = (BigInteger) eventValues.getIndexedValues().get(0).getValue();
            responses.add(typedResponse);
        }
        return responses;
    }

    public void subscribeInvestmentDeletedEvent(String fromBlock, String toBlock, List<String> otherTopics, EventCallback callback) {
        String topic0 = eventEncoder.encode(INVESTMENTDELETED_EVENT);
        subscribeEvent(ABI,BINARY,topic0,fromBlock,toBlock,otherTopics,callback);
    }

    public void subscribeInvestmentDeletedEvent(EventCallback callback) {
        String topic0 = eventEncoder.encode(INVESTMENTDELETED_EVENT);
        subscribeEvent(ABI,BINARY,topic0,callback);
    }

    public static InvestmentManagement load(String contractAddress, Client client, CryptoKeyPair credential) {
        return new InvestmentManagement(contractAddress, client, credential);
    }

    public static InvestmentManagement deploy(Client client, CryptoKeyPair credential) throws ContractException {
        return deploy(InvestmentManagement.class, client, credential, getBinary(client.getCryptoSuite()), "");
    }

    public static class InvestmentCreatedEventResponse {
        public TransactionReceipt.Logs log;

        public BigInteger id;

        public String investor;

        public BigInteger amount;

        public String projectName;

        public byte[] dataHash;

        public byte[] txHash;
    }

    public static class InvestmentUpdatedEventResponse {
        public TransactionReceipt.Logs log;

        public BigInteger id;

        public BigInteger amount;

        public String projectName;

        public byte[] dataHash;

        public byte[] txHash;
    }

    public static class InvestmentDeletedEventResponse {
        public TransactionReceipt.Logs log;

        public BigInteger id;
    }
}
